import random
import sys

money = 1000
a = 0
b = 0

while a == 3 or b == 3:

    say2 = input()
    say2 = int(say2)
    
while a < 3 and b < 3:
    say2 = input()
    say2 = int(say2)

    if say2 == 1:
        cards1 = random.randint(1, 15)
        cards2 = random.randint(1, 15)
        cards3 = random.randint(1, 15)
        print('מאיזה חבילה תירצו למשוך כלף 1 או 2 או 3')
        say1 = input()
        say1 = int(say1)
        cardsc1 = random.randint(1, 15)
        cardsc2 = random.randint(1, 15)
        cardsc3 = random.randint(1, 15)
        cardsc1 = int(cardsc1)
        cards1 = int(cards1)
        say2 = 0
        
        if say1 == 1 and cards1 > cardsc1:
            a = a + 1

            print(cardsc1)

            print(cards1)
        
        if say1 == 1 and cards1 < cardsc1:
            b = b + 1
            print(cardsc1)

            print(cards1)
                    
        if say1 == 1 and cards1 == cardsc1:
            print('טקו')

            print(cardsc1)

            print(cards1)

        if say1 == 2 and cards2 == cardsc2:
            print('טקו')

            print(cardsc2)
                
            print(cards2)

        if say1 == 2 and cards2 > cardsc2:
            print(cardsc2)
            a = a + 1
            print(cards2)


        if say1 == 2 and cards2 < cardsc2:
            print(cardsc2)
            b = b + 1                
            print(cards2)


        if say1 == 3 and cards3 == cardsc3:
            print('טקו')

            print(cardsc1)

            print(cards1)

        if say1 == 3 and cards3 > cardsc3:
            print(cardsc3)
            a = a + 1
            print(cards3)


        if say1 == 3 and cards3 < cardsc3:
            print(cardsc3)
            b = b + 1
            print(cards3)

        if a == 3:
            print('ניצחתה')

        if b == 3:
            print('הפסדת')












                
